﻿using System.Security.Authentication.ExtendedProtection;

namespace Collections;

public class CollectionOfObjects
{
    public void CollectionsItem()
    {
        List<Product> products = new List<Product>();

        // Add
        string choice = string.Empty;
        do
        {
            Console.Write("Enter ID");
            int pid = int.Parse(Console.ReadLine());
            Console.Write("Enter Name");
            string pName = Console.ReadLine();
            Console.Write("Enter Price");
            double pPrice = double.Parse(Console.ReadLine());
            DateTime dom = DateTime.Now;

            Product product = new Product()
            {
                Id = pid,
                Name = pName,
                Price = pPrice,
                DateOfManufacture = dom
            };

            products.Add(product);

            Console.WriteLine("Do you want to continue to next product?(Yes/No)");
            choice = Console.ReadLine();
        } while (choice != "No" || choice != "no" || choice != "N" || choice != "n");


        foreach (Product item in products)
        {
            Console.WriteLine(item.Id);
            Console.WriteLine(item.Name);
            Console.WriteLine(item.Price);
            Console.WriteLine(item.DateOfManufacture);
        }
    }
}